/*
 * Author: vdaras
 */

#ifndef ABSTRACTBUTTON_H
#define	ABSTRACTBUTTON_H

#include "Component.h"

#include "ActionListener.h"
#include <list>

class MouseEvent;

namespace gui
{
    
/**
 * Class providing an interface and common functionality for several
 * types of buttons.
 */

class AbstractButton : public Component
{
protected:
    
    const static int REGULAR = 0;
    const static int HIGHLIGHTED = 1;
    const static int CLICKED = 2;
    
    int m_currentDisplay;
    bool m_clicked;

public:

    /**
     * Constructor that initializes the Abstract Button's id, width and height
     *
     * @param name: component's id
     * @param width: width of button
     * @param height: height of button
     */

    AbstractButton(const std::string &name, int width, int height);


    /**
     * Constructor that initializes the Abstract Button's id, width , height, parent
     * container and its position inside the container.
     *
     * @param name: component's id
     * @param parent: container holding this component
     * @param x: x position inside the container
     * @param y: y position inside the container
     * @param width: width of button
     * @param height: height of button
     */

    AbstractButton(const std::string &name, Container *parent, int x, int y, int width, int height);


    virtual ~AbstractButton();
    
    
    /**
     * Handles a mouse event occurred.
     *
     * @param event: the event.
     */
    
    virtual void OnMouseEvent(MouseEvent &event);

protected:

    /**
     * This routine returns whether the mouse cursor's coordinates are inside the
     * area of the Button.
     *
     * @param mouseX: x coordinate of the mouse cursor
     * @param mouseY: y coordinate of the mouse cursor
     * @return true if cursor is inside the button, otherwise false
     */

    bool CursorInArea(int mouseX, int mouseY);


    /**
     * This routine notifies each Action Listener that an action was performed to this
     * Button.
     */

    void FireActionEvent();
};

};

#endif	/* ABSTRACTBUTTON_H */

